<?php


namespace app\provider;


use app\Listeners\OrderPayHandler;
use yii\base\BootstrapInterface;

class HandlerLoader implements BootstrapInterface
{
    public function bootstrap($app)
    {
        $this->load();
        // TODO: Implement bootstrap() method.
    }


    public function load()
    {
        /**
         * 注册应用事件
         */
        $handlers = [
            OrderPayHandler::class
        ];

        foreach ($handlers as $handlerClass)
        {
            $handler = new $handlerClass();

            if (!empty($handler))
            {
                $handler->register();
            }
        }
    }
}